@isTest
private class UpsertProductRESTTest {
    static testMethod void testMethod1() {
        //TestUtils.createUsers();
      //  User appMan = [SELECT Id,Name FROM User WHERE Name='用户1' LIMIT 1];
		
		//创建品牌
		Brand__c brd1 = new Brand__c();
		brd1.Name = '迈克生物';
		insert brd1;

		Brand__c brd2 = new Brand__c();
		brd2.Name = '德国强生';
		insert brd2;
		
		Test.startTest();
		//测试
		List<UpsertProductREST.ProductRestArgs> args = new List<UpsertProductREST.ProductRestArgs>();
		UpsertProductREST.upsertProduct(args);

		UpsertProductREST.ProductRestArgs arg1 = new UpsertProductREST.ProductRestArgs();
		arg1.invcode = 'P001021548';//产品编码
        arg1.invname = '血清试剂'; //产品名称
        arg1.invspec = '20x30'; //规格
        arg1.invtype = 'kjhhj'; //型号
        arg1.invshortname = '血清试剂'; //产品简称
        arg1.invmnecode = 'P001'; //助记码
        arg1.invclcode = 'I-001'; //存货分类编码
        arg1.invclname = '试剂'; //存货分类名称
        arg1.jldw = '支';//计量单位
        arg1.fjldw = '盒';//辅量单位
        arg1.taxitems = 'T025';//税目
        arg1.cpx = '试剂';//产品线
        arg1.vpp = '迈克生物';//品牌
        arg1.vpzwh = '川卫.25487944';//批准文号
        arg1.pzwhdate = '2019-12-31';//批准文号到期日
        arg1.sealflag = 'N';
		arg1.ts = '2017-01-01 15:00:00';
        arg1.pk_invbasdoc = 'p000001';
        arg1.swjhdj='11.11 ';
        arg1.bggsjhdj='11.11 ' ;
		args.add(arg1);
		
		UpsertProductREST.ProductRestArgs arg2 = new UpsertProductREST.ProductRestArgs();
		arg2.invcode = 'P001021228';//产品编码
        arg2.invname = '血清试剂2'; //产品名称
        arg2.invspec = '10x30'; //规格
        arg2.invtype = 'd4223'; //型号
        arg2.invshortname = '血清2'; //产品简称
        arg2.invmnecode = 'P001'; //助记码
        arg2.invclcode = 'I-001'; //存货分类编码
        arg2.invclname = '试剂'; //存货分类名称
        arg2.jldw = '支';//计量单位
        arg2.fjldw = '盒';//辅量单位
        arg2.taxitems = 'T025';//税目
        arg2.cpx = '试剂';//产品线
        arg2.vpp = '德国强生';//品牌
        arg2.vpzwh = '川卫.25487923';//批准文号
        arg2.pzwhdate = '2019-12-32';//批准文号到期日
		arg2.ts = '2017-01-01 07:03:01';
        arg2.sealflag = 'N';
        arg2.pk_invbasdoc = 'p000002';
        arg2.swjhdj='11.11 ';
        arg2.bggsjhdj='11.11 '; 
		args.add(arg2);
		
		UpsertProductREST.upsertProduct(args);
		
		UpsertProductREST.ProductRestArgs arg3 = new UpsertProductREST.ProductRestArgs();
		arg3.invcode = 'P001021229';//产品编码
        arg3.invname = '血清试剂3 dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss'; //产品名称
        arg3.invspec = '10x30'; //规格
        arg3.invtype = 'd4223'; //型号
        arg3.invshortname = '血清2'; //产品简称
        arg3.invmnecode = 'P001 dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss'; //助记码
        arg3.invclcode = 'I-001'; //存货分类编码
        arg3.invclname = '试剂'; //存货分类名称
        arg3.jldw = '支';//计量单位
        arg3.fjldw = '盒';//辅量单位
        arg3.taxitems = 'T025';//税目
        arg3.cpx = '试剂';//产品线
        arg3.vpp = '四川生物';//品牌
        arg3.vpzwh = '川卫.25487955';//批准文号
        arg3.pzwhdate = 'fdgfdgfd';//批准文号到期日
		arg3.ts = '2017dd';
        arg3.sealflag = 'N';
        arg3.pk_invbasdoc = 'p000003';
        arg3.swjhdj='11.11 ';
        arg3.bggsjhdj='11.11 ';    
		args.add(arg3);
		
		UpsertProductREST.upsertProduct(args);
		Test.stopTest();
    }
}